<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>在树莓派3上部署qiandao.today签到程序 | haijd</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <meta name="keywords" content="树莓派应用" />
  
  
  
  
  <meta name="description" content="在树莓派3上部署qiandao.today签到程序">
<meta name="keywords" content="树莓派应用">
<meta property="og:type" content="article">
<meta property="og:title" content="在树莓派3上部署qiandao.today签到程序">
<meta property="og:url" content="http://www.hais2.com/2017/03/15/Raspberry-pie3-deployed-on-the-qiandao.today-check-in-procedures/index.html">
<meta property="og:site_name" content="haijd">
<meta property="og:description" content="在树莓派3上部署qiandao.today签到程序">
<meta property="og:locale" content="default">
<meta property="og:image" content="http://www.hais2.com/image/raspberry/pi-1.png">
<meta property="og:image" content="http://www.hais2.com/image/raspberry/pi-2.png">
<meta property="og:image" content="http://www.hais2.com/image/raspberry/pi-3.png">
<meta property="og:updated_time" content="2017-08-02T15:22:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="在树莓派3上部署qiandao.today签到程序">
<meta name="twitter:description" content="在树莓派3上部署qiandao.today签到程序">
<meta name="twitter:image" content="http://www.hais2.com/image/raspberry/pi-1.png">
  
    <link rel="alternate" href="/atom.xml" title="haijd" type="application/atom+xml">
  
  <link rel="icon" href="/css/images/favicon.ico">
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link href="https://fonts.googleapis.com/css?family=Open+Sans|Montserrat:700" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic" rel="stylesheet" type="text/css">
  <link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  <style type="text/css">
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/9749f0/00000000000000000001008f/27/l?subset_id=2&fvd=n5) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/90cf9f/000000000000000000010091/27/l?subset_id=2&fvd=n7) format("woff2");font-weight:500;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/8a5494/000000000000000000013365/27/l?subset_id=2&fvd=n4) format("woff2");font-weight:lighter;font-style:normal;}
    @font-face{font-family:futura-pt;src:url(https://use.typekit.net/af/d337d8/000000000000000000010095/27/l?subset_id=2&fvd=i4) format("woff2");font-weight:400;font-style:italic;}</style>
    
  <link rel="stylesheet" id="athemes-headings-fonts-css" href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz%3A200%2C300%2C400%2C700&amp;ver=4.6.1" type="text/css" media="all">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/jquery-3.1.1.min.js"></script>

  <!-- Bootstrap core CSS -->
  <link rel="stylesheet" href="/css/bootstrap.css" >
  <link rel="stylesheet" href="/css/hiero.css" >
  <link rel="stylesheet" href="/css/glyphs.css" >
  
    <link rel="stylesheet" href="/css/vdonate.css" >
  

</head>

<script>
var themeMenus = {};

  themeMenus["/"] = "Home"; 

  themeMenus["/archives"] = "Archives"; 

  themeMenus["/categories"] = "Categories"; 

  themeMenus["/tags"] = "Tags"; 

  themeMenus["/about"] = "About"; 

</script>


  <body data-spy="scroll" data-target="#toc" data-offset="50">


  <header id="allheader" class="site-header" role="banner">
  <div class="clearfix container">
      <div class="site-branding">

          <h1 class="site-title">
            
              <a href="/" title="haijd" rel="home"> haijd </a>
            
          </h1>

          
            <div class="site-description">Stay Hungry,Stay Foolish</div>
          
            
          <nav id="main-navigation" class="main-navigation" role="navigation">
            <a class="nav-open">Menu</a>
            <a class="nav-close">Close</a>
            <div class="clearfix sf-menu">

              <ul id="main-nav" class="nmenu sf-js-enabled">
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/">Home</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/archives">Archives</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/categories">Categories</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/tags">Tags</a> </li>
                    
                      <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1663"> <a class="" href="/about">About</a> </li>
                    
              </ul>
            </div>
          </nav>


      </div>
  </div>
</header>




  <div id="container">
    <div id="wrap">
            
      <div id="content" class="outer">
        
          <section id="main" style="float:none;"><article id="post-Raspberry-pie3-deployed-on-the-qiandao.today-check-in-procedures" style="width: 66%; float:left;" class="article article-type-post" itemscope itemprop="blogPost" >
  <div id="articleInner" class="clearfix post-1016 post type-post status-publish format-standard has-post-thumbnail hentry category-template-2 category-uncategorized tag-codex tag-edge-case tag-featured-image tag-image tag-template">
    
    
      <header class="article-header">
        
  
    <h1 class="thumb" class="article-title" itemprop="name">
      在树莓派3上部署qiandao.today签到程序
    </h1>
  

      </header>
    
    <div class="article-meta">
      
	Posted on <a href="/2017/03/15/Raspberry-pie3-deployed-on-the-qiandao.today-check-in-procedures/" class="article-date">
	  <time datetime="2017-03-15T12:41:35.000Z" itemprop="datePublished">March 15, 2017</time>
	</a>

      
	<span id="busuanzi_container_page_pv">
	  本文总阅读量<span id="busuanzi_value_page_pv"></span>次
	</span>

    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="项目介绍"><a href="#项目介绍" class="headerlink" title="项目介绍"></a>项目介绍</h2><p>　　<a href="https://qiandao.today/" target="_blank" rel="noopener">qiandao.today</a>是一个在github上开源的自动签到框架，使用python开发，作者是<a href="http://binux.me/" target="_blank" rel="noopener">binux</a>。</p>
<p>　　github:<a href="https://github.com/binux/qiandao" target="_blank" rel="noopener">https://github.com/binux/qiandao</a></p>
<h2 id="部署在本地的树莓派上"><a href="#部署在本地的树莓派上" class="headerlink" title="部署在本地的树莓派上"></a>部署在本地的树莓派上</h2><h3 id="准备"><a href="#准备" class="headerlink" title="准备"></a>准备</h3><p>　　首先我们准备一台安装好linux系统(raspbian、ubuntu等)的树莓派(我这里使用的是树莓派3)，连接接显示器并联网，连接键鼠。<br><a id="more"></a><br>　　操作系统为基于Debian8的Raspbian。并且修改镜像源为国内镜像，然后执行命令更新软件源：<code>sudo apt-get update</code></p>
<h3 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h3><p>　　签到项目是使用python开发的，被树莓派完美支持，只需安装2.7版本的python即可(如果你的系统是树莓派官方的Raspbian的话，就不需要安装了，系统自带2.7版本的python)。</p>
<h4 id="1-clone项目"><a href="#1-clone项目" class="headerlink" title="1. clone项目"></a>1. clone项目</h4><p>　　首先找一个合适的位置，准备存放你的签到项目，我准备放在<code>Documents</code>文件夹下面，县使用命令行：<code>cd /home/pi/Documents</code>回车进入<code>Documents</code>文件下下面：</p>
<p>　　然后使用命令clone项目：<code>git clone https://github.com/binux/qiandao.git</code><br><img src="/image/raspberry/pi-1.png" alt=""></p>
<p>　　如果没有执行clone，可能是git没有安装，执行命令：<code>sudo apt-get install git</code>  安装完git再执行上面的克隆命令。</p>
<h4 id="2-安装项目依赖的组件"><a href="#2-安装项目依赖的组件" class="headerlink" title="2.安装项目依赖的组件"></a>2.安装项目依赖的组件</h4><p>　　项目我们已经克隆倒本地了，现在我们需要安装运行项目所需要的组件。参照项目中的<code>README.md</code>，我们知道需要安装sqlte3数据库，还有好几个python依赖组件。</p>
<p>　　首先我们使用命令安装sqlite3数据库：<code>sudo apt-get install sqlite3</code></p>
<p>　　接下来使用项目<code>README.md</code>介绍里面的两条命令安装依赖：<br><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install python-dev autoconf g++ python-pbkdf2</span><br><span class="line">sudo pip install tornado u-msgpack-python jinja2 chardet requests pbkdf2 pycrypto</span><br></pre></td></tr></table></figure></p>
<p>PS：如果安装失败，很可能是网络原因，需要改用国内镜像安装，这里我们使用<a href="https://www.douban.com/note/302711300/" target="_blank" rel="noopener">豆瓣源</a>安装：在命令<code>install</code>后面加上<code>-i http://pypi.douban.com/simple/</code> 即可，例如：<br><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo pip install -i http://pypi.douban.com/simple/ tornado u-msgpack-python jinja2 chardet requests pbkdf2 pycrypto</span><br></pre></td></tr></table></figure></p>
<h3 id="启动"><a href="#启动" class="headerlink" title="启动"></a>启动</h3><p>　　至此我们的准备工作都已经做完了，是时候启动项目了。</p>
<p>　　首先进入刚才clone的项目文件夹：<code>cd /home/pi/Documents/qiandao</code></p>
<p>　　然后执行命令：<code>./run.py</code></p>
<p>　　回车后我们就可以看到项目已经启动了，窗口显示了请求地址以及端口号：<br><img src="/image/raspberry/pi-2.png" alt=""></p>
<p>　　这是我们已经可以在浏览器访问了，在树莓派里面打开浏览器，输入<code>127.0.0.1:8923</code>然后回车访问，就可以直接浏览了：<br><img src="/image/raspberry/pi-3.png" alt=""></p>
<h2 id="结束"><a href="#结束" class="headerlink" title="结束"></a>结束</h2><p>　　至此<a href="https://qiandao.today/" target="_blank" rel="noopener">qiandao.today</a>项目已经部署到树莓派上面了，如果我们想在局域网内的其他设备上访问，可以在树莓派里面使用命令：<code>ifconfig</code>查看树莓派的ip地址，然后在其他设备输入<code>IP:8923</code>，就可以访问啦。如果更近一步，我们想使用外网访问，那么可以使用花生壳做外网映射，就可以在任何设备上访问你部署在树莓派上的签到网站了，关于树莓派花生壳外网映射，可以参照这篇文章：<a href="http://service.oray.com/question/2680.html" target="_blank" rel="noopener">花生壳 3.0 for 树莓派 安装使用攻略</a>。</p>
<p>　　这篇文章写到这里就结束了，如果大家在部署的时候遇到问题，可以在“关于页面找到我的联系方式，希望我能帮到你。”</p>

      
    </div>
    <footer class="entry-meta entry-footer">
      
	<span class="ico-folder"></span>
    <a class="article-category-link" href="/categories/Raspberry/">Raspberry</a>

      
  <span class="ico-tags"></span>
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/树莓派应用/">树莓派应用</a></li></ul>

      
        <div id="donation_div"></div>

<script src="/js/vdonate.js"></script>
<script>
var a = new Donate({
  title: '如果觉得我的文章对您有用，请随意打赏。您的支持将鼓励我继续创作!', // 可选参数，打赏标题
  btnText: 'Donate', // 可选参数，打赏按钮文字
  el: document.getElementById('donation_div'),
  wechatImage: '/css/images/wechatPay.png',
  alipayImage: '/css/images/alipay.jpg'
});
</script>
      

      
        
	<section id="comments" class="comment">
	  <div id="disqus_thread">
	  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
	  </div>
	</section>

	<script type="text/javascript">
	var disqus_shortname = 'haijdblog';
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	(function(){
	  var dsq = document.createElement('script');
	  dsq.type = 'text/javascript';
	  dsq.async = true;
	  dsq.src = '//' + disqus_shortname + '.disqus.com/count.js';
	  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}());
	</script>


      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2017/04/10/Java-this&super-keyword/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Java基础：this&amp;super关键字
        
      </div>
    </a>
  
  
    <a href="/2017/03/15/微信JSSDK的使用/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">微信JSSDK的使用</div>
    </a>
  
</nav>

  
</article>

<!-- Table of Contents -->

  <aside id="sidebar">
    <div id="toc" class="toc-article">
    <strong class="toc-title">Contents</strong>
    
      <ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#项目介绍"><span class="nav-number">1.</span> <span class="nav-text">项目介绍</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#部署在本地的树莓派上"><span class="nav-number">2.</span> <span class="nav-text">部署在本地的树莓派上</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#准备"><span class="nav-number">2.1.</span> <span class="nav-text">准备</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#部署"><span class="nav-number">2.2.</span> <span class="nav-text">部署</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-clone项目"><span class="nav-number">2.2.1.</span> <span class="nav-text">1. clone项目</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-安装项目依赖的组件"><span class="nav-number">2.2.2.</span> <span class="nav-text">2.安装项目依赖的组件</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#启动"><span class="nav-number">2.3.</span> <span class="nav-text">启动</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#结束"><span class="nav-number">3.</span> <span class="nav-text">结束</span></a></li></ol>
    
    </div>
  </aside>
</section>
        
      </div>
      <footer id="footer" class="site-footer">
  

  <div class="clearfix container">
      <div class="site-info">
	      &copy; 2018 haijd All Rights Reserved.
          
            <span id="busuanzi_container_site_uv">
              本站访客数<span id="busuanzi_value_site_uv"></span>人次  
              本站总访问量<span id="busuanzi_value_site_pv"></span>次
            </span>
          
      </div>
      <div class="site-credit">
        Theme by <a href="https://github.com/iTimeTraveler/hexo-theme-hiero" target="_blank">hiero</a>
      </div>
  </div>
</footer>


<!-- min height -->

<script>
    var contentdiv = document.getElementById("content");

    contentdiv.style.minHeight = document.body.offsetHeight - document.getElementById("allheader").offsetHeight - document.getElementById("footer").offsetHeight + "px";
</script>
    </div>
    <!-- <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/categories" class="mobile-nav-link">Categories</a>
  
    <a href="/tags" class="mobile-nav-link">Tags</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav> -->
    

<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/scripts.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/main.js"></script>








	<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
	</script>






  </div>

  <a id="rocket" href="#top" class=""></a>
  <script type="text/javascript" src="/js/totop.js" async=""></script>
</body>
</html>
